package trefliq.EJB.webservice;

import java.util.List;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import trefliq.EJB.entities.Employee;
import trefliq.EJB.entities.Movie;
import trefliq.EJB.sessionbeans.EmployeeSession;

/**
 *
 * @author Brandon
 */
//@WebService(serviceName = "EmployeeWebService")
@Stateless()
public class EmployeeWebService {
    @EJB
    private EmployeeSession ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "createEmployee")
    public Employee createEmployee(@WebParam(name = "e") Employee e) {
        return ejbRef.createEmployee(e);
    }

    @WebMethod(operationName = "deleteEmployee")
    public Employee deleteEmployee(@WebParam(name = "e") Employee e) {
        return ejbRef.deleteEmployee(e);
    }

    @WebMethod(operationName = "getAllEmployees")
    public List<Employee> getAllEmployees() {
        return ejbRef.getAllEmployees();
    }

    @WebMethod(operationName = "getEmployeeById")
    public Employee getEmployeeById(@WebParam(name = "employeeId") Long employeeId) {
        return ejbRef.getEmployeeById(employeeId);
    }

    @WebMethod(operationName = "getEmployeeByPersonId")
    public Employee getEmployeeByPersonId(@WebParam(name = "personId") Long personId) {
        return ejbRef.getEmployeeByPersonId(personId);
    }
    
    @WebMethod(operationName = "addMovie")
    public boolean addMovie(@WebParam(name = "movie") Movie movie) {
        return ejbRef.addMovie(movie);
    }

    @WebMethod(operationName = "updateMovie")
    public boolean updateMovie(@WebParam(name = "movie") Movie movie) {
        return ejbRef.updateMovie(movie);
    }

    @WebMethod(operationName = "deleteMovie")
    public boolean deleteMovie(@WebParam(name = "movie") Movie movie) {
        return ejbRef.deleteMovie(movie);
    }
    
}
